import http from '../../core/request'
import { Inquiry } from './index.type'
// 获取活动列表
const getInquiryList = (params: Inquiry.Params.Search, isShowLoading: boolean = true) => {
    return http.get<Inquiry.List>('/inquiry-pool', params, { loading: isShowLoading })
}
//发布询价
const getNewInqury = (params: Inquiry.Params.NewInqury) => {
  return http.post('/inquiry-pool', params, { loading: true })
}
//获取询价详情
const getInquiryDetail = (id: string, isload: boolean = true) => {
  return http.get<Inquiry.Item>(`/inquiry-pool/${id}`, {}, {loading: isload})
}
//取消询价
const getInquiryCancel = (id: string) => {
  return http.patch(`/inquiry-pool/${id}/cancel`, {}, { loading: true })
}
//删除询价
const getInquiryDelete = (id: string) => {
  return http.delete(`/inquiry-pool/${id}`, {}, { loading: true })
}
//催单
const getInquiryRush = (id: string, isload: boolean = true) => {
  return http.get(`/qxt/material/inquiry/${id}/rush`, {}, {loading: isload})
}
//置顶
const getInquiryReminder = (id: string,params : {
  jobNumber : string
}, isload: boolean = true) => {
  return http.get(`/qxt/material/inquiry/${id}/reminder`, params, {loading: isload})
}
//采纳
const getInquiryAdopt = (id: string,params : {
  jobNumber : string
}, isload: boolean = true) => {
  return http.get(`/qxt/material/inquiry/${id}/adopt`, params, {loading: isload})
}
//点赞
const getInquiryLike = (id: string, isload: boolean = true) => {
  return http.get(`/qxt/material/inquiry/${id}/like`, {}, {loading: isload})
}
//查询报价信息
const getReplyList = (params: Inquiry.Params.reply, isShowLoading: boolean = true) => {
  return http.get<Inquiry.listReply>(`/inquiry-pool/inquiry/reply/list`, params, { loading: isShowLoading })
}
//获取评论列表
const getCommentList = (params: Inquiry.Params.comment, isShowLoading: boolean = true) => {
  return http.get<Inquiry.ListComment>('/inquiry-pool/comment/list', params, { loading: isShowLoading })
}
//发布评论
const getCommentAdd = (params: Inquiry.Params.CommentAdd) => {
  return http.post('/inquiry-pool/comment/add', params, { loading: true })
}
//查看操作日志
const getinquiryLog = (params: Inquiry.Params.Log,id : string, isShowLoading: boolean = true) => {
  return http.get<Inquiry.LogInquiry>(`/qxt/material/inquiry/${id}`, params, { loading: isShowLoading })
}
export default {
    getInquiryList,
    getNewInqury,
    getInquiryDetail,
    getCommentList,
    getCommentAdd,
    getInquiryCancel,
    getInquiryDelete,
    getReplyList,
    getinquiryLog,
    getInquiryAdopt,
    getInquiryRush,
    getInquiryReminder,
    getInquiryLike
}